// pages/myDiscount/myDiscount.js
var util = require('../../utils/util.js');
Page({
  data: {
    myDiscountNum: 5,
    hasDiscount: false,
    myDiscount: [], //我的优惠券列表
    rpacket_end_date:'', //优惠券结束时间
    discountIndex:''
  },
  onLoad: function (options) {

  },
  onShow: function () {
    var that = this;
    util.postUrl('member_red_packet/packet_list', {
      page_num:10
    }, function (res) {
      if (res.data.code == 200) {
        console.log('dddddd', res.data.datas.packet_list);
        let myDiscount = that.data.myDiscount;
        that.setData({
          myDiscount:res.data.datas.packet_list,
          myDiscountNum: res.data.datas.packet_list.length,
          hasDiscount: true 
        })
      }
    })
  },
  // 去使用：
  goUsed:function(e){
    console.log(e)
  },
  onHide: function () {

  },
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})